package com.coldchain ;

import com.coldchain.authclient.interceptor.UserAuthRestInterceptor;
import com.spring4all.swagger.EnableSwagger2Doc;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.bind.annotation.RequestMapping;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@EnableAutoConfiguration
@EnableEurekaClient
@ComponentScan(value={"com.coldchain"})
@EnableFeignClients(value={"com.coldchain.authclient.feign","com.coldchain.common.feign"})
@EnableTransactionManagement
@EnableSwagger2
@EnableSwagger2Doc
@Controller
public class ServerHzMain {
    public static void main(String[] args) {
//    	BaseContextHandler
        SpringApplication.run(ServerHzMain.class, args);
    }
    @Bean
    public UserAuthRestInterceptor userAuthRestInterceptor(){
    	return new UserAuthRestInterceptor();
    }
    
    @RequestMapping("/hz/v2/api-docs")
    public String  apiDoc(){
        return "redirect:/v2/api-docs";
    }
    
}
